import request from '@/utils/request'

// 银行账号开始---------------------------
export function getAccounts(params) {
  return request({
    url: '/finance/account/',
    method: 'GET',
    params
  })
}

export function getAccountList() {
  return request({
    url: '/finance/account_list/',
    method: 'GET',
  })
}

export function addAccount(data) {
  return request({
    url: '/finance/account/',
    method: 'POST',
    data
  })
}


export function updateAccount(data) {
  return request({
    url: `/finance/account/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delAccount(id) {
  return request({
    url: `/finance/account/${id}/`,
    method: 'DELETE',
  })
}
// 银行账号结束

// 流水账开始---------------------------
export function getJournals(params) {
  return request({
    url: '/finance/journal/',
    method: 'GET',
    params
  })
}


export function delJournals(data) {
  return request({
    url: '/finance/journal/batch_delete/',
    method: 'DELETE',
    data
  })
}
// 流水账结束
//预付款开始

export function getPrepaymentMaxCode(params) {
  return request({
    url: '/base/prepayment_code/',
    method: 'GET',
    params
  })
}

export function getPrepaymentList(params) {
  return request({
    url: '/finance/prepayment_list/',
    method: 'GET',
    params
  })
}

export function getPrepayments(params) {
  return request({
    url: '/finance/prepayment/',
    method: 'GET',
    params
  })
}

export function addPrepayment(data) {
  return request({
    url: '/finance/prepayment/',
    method: 'POST',
    data
  })
}


export function updatePrepayment(data) {
  return request({
    url: `/finance/prepayment/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delPrepayment(id) {
  return request({
    url: `/finance/prepayment/${id}/`,
    method: 'DELETE',
  })
}


export function delPrepayments(data) {
  return request({
    url: `/finance/prepayment/batch_delete/`,
    method: 'DELETE',
    data
  })
}
//预付款结束